#!/opt/bin/python2.6

import sys
sys.path.append("/volume1/dev/python/lib")
import re,MySQLdb,mod_ced
from datetime import datetime, date, time

print "Content-Type: text/html"
print
print """
<!DOCTYPE html> 
<html>
<head>
        <title>Domotique Paillet</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
        <link rel="stylesheet" href="/media/css/ced_mobile.css" />
        <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<form action="mobile_modif_force.cgi" method="get">
<div data-role="fieldcontain">
			    <fieldset data-role="controlgroup" data-type="horizontal">
			     	<legend>Layout view:</legend>"""
for typejour  in  mod_ced.typejs.keys():
	if ( mod_ced.force.programme == typejour):
		print '<input type="radio" name="typejour" id="'+ mod_ced.typejs[typejour].name+'" value="'+ str(typejour)+'" checked="checked" />'
	else:
		print '<input type="radio" name="typejour" id="'+ mod_ced.typejs[typejour].name+'" value="'+ str(typejour)+'"/>'
	print '<label for="'+ mod_ced.typejs[typejour].name+'">'+ mod_ced.typejs[typejour].name+'</label>'
print """			    </fieldset>
			</div>


<div data-role="fieldcontain">
    <fieldset data-role="controlgroup" data-type="horizontal">
        <legend>duree</legend>
        <label for="day">jour</label>
        <select name="day" id="day">"""
for i in range(7):
	print '<option value="'+str(i)+'">'+str(i)+'j</option>'
print """ </select>
        <label for="hour">hour</label>
        <select name="hour" id="hour">"""
for i in range(24):
	print '<option value="'+str(i)+'">'+str(i)+'h</option>'

print """   </select>
        
    </fieldset>
</div>
<div class="ui-body ui-body-b">
		<fieldset class="ui-grid-a">
				<div class="ui-block-a"><button type="submit" data-theme="d">Cancel</button></div>
				<div class="ui-block-b"><button type="submit" data-theme="a">Submit</button></div>
	    </fieldset>
		</div>
</form>
</body>
</html>
"""
